<template>
  <div class="detail">
    <dv-loading v-if="isShow">
      <p>数据加载中......</p>
    </dv-loading>
    <div class="box" v-if="!isShow">
      <div class="header">
        <div class="left">
          <span @click="goback">返回</span>
        </div>
        <div class="right">出行事由列表</div>
      </div>
      <div class="bom">
        <dv-scroll-board :config="config" style="width: 60vw; height: 70%" />
      </div>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import { getGetCarApplyReasonRank } from "@/api/dataV/index";
export default {
  data() {
    return {
      isShow: true,
      config: {},
    };
  },
  mounted() {
    setTimeout(() => {
      this.isShow = false;
    }, 1000);
    this.init();
  },
  methods: {
    init() {
      getGetCarApplyReasonRank().then((res) => {
        const arrData = res.map((v) => {
          return [`<span>${v.name}</span>`, `<span>${v.percent}</span>`];
        });
        this.config = {
          index: true,
          data: arrData,
          columnWidth: [50, 1000, 100],
          rowNum: 10,
        };
      });
    },
    goback() {
      this.$router.push({
        path: "/",
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.detail {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: url(./../../assets/datav/detailbg.png) no-repeat;
  background-size: 100% 100%;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  p {
    color: #fff;
    font-size: 26px;
  }
  .box {
    width: 90vw;
    height: 100vh;
    .header {
      width: 90vw;
      height: 100px;
      display: flex;
      align-items: center;
      .right {
        flex: 1;
        height: 72px;
        pointer-events: auto;
        display: flex;
        align-items: center;
        color: rgb(30, 255, 255);
        font-weight: normal;
        font-family: "Microsoft Yahei", Arial, "sans-serif";
        font-size: 45px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        cursor: pointer;
      }
      .left {
        cursor: pointer;
        width: 40%;
        pointer-events: auto;
        display: flex;
        align-items: center;
        color: rgb(255, 255, 255);
        font-weight: normal;
        font-family: "Microsoft Yahei", Arial, "sans-serif";
        font-size: 20px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
      }
    }
    .bom {
      width: 90vw;
      height: calc(100vh - 100px);
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}
</style>
